package com.ruoyi.business.enums;

import java.util.ArrayList;
import java.util.List;

public enum TransTypeEnum {

    BD09TOGCJ02(1, "百度转火星"),
    BD09TOWGS84(2, "百度转84"),
    GCJ02TOWGS84(3, "火星转84"),
    WGS84TOGCJ02(4, "84转火星"),
    GCJ02TOBD09(5, "火星转百度"),
    WGS84TOBD09(6, "84转百度"),
    ;


    private String name;
    private int index;

    private TransTypeEnum(int index, String name) {
        this.name = name;
        this.index = index;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public static List<String> getData() {
        List<String> list = new ArrayList<>();
        for (TransTypeEnum stateEnum : TransTypeEnum.values()) {
            list.add(stateEnum.getName());
        }
        return list;
    }

    public static int getIndexByName(String name) {
        int i = 0;
        for (TransTypeEnum transTypeEnum :
                TransTypeEnum.values()) {
            if (transTypeEnum.getName().equals(name)) {
                i = transTypeEnum.getIndex();
            }
        }
        return i;
    }

    public static TransTypeEnum getEnum(Integer index) {
        TransTypeEnum transTypeEnum = null;
        for (TransTypeEnum transTypeEnum1 : TransTypeEnum.values()) {
            if (transTypeEnum1.getIndex() == index) {
                transTypeEnum = transTypeEnum1;
                break;
            }
        }
        return transTypeEnum;
    }

}

